package com.ruoyi.teaching.api.factory;

import com.ruoyi.common.core.domain.R;
import com.ruoyi.teaching.api.RemoteDayilyService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;

/**
 * 用户服务降级处理
 *
 * @author coach tam
 */
@Component
public class RemoteDayilyFallbackFactory implements FallbackFactory<RemoteDayilyService>
{
    private static final Logger log = LoggerFactory.getLogger(RemoteDayilyFallbackFactory.class);

    @Override
    public RemoteDayilyService create(Throwable cause) {
        return new RemoteDayilyService() {
            @Override
            public R<Void> createDailyTasks() {
                return R.fail("创建每日任务失败:" + log.getName());
            }

            @Override
            public R<Void> overdueDailies() {
                return R.fail("过期每日任务失败:" + log.getName());
            }
        };
    }
}
